import time

from selenium import webdriver
from selenium.webdriver.common.by import By

# tile-title title-ltr
chrome = webdriver.Chrome()
chrome.get('https://www.w3school.com.cn/')
time.sleep(2)
lst = chrome.find_elements(By.CSS_SELECTOR, '#navsecond a:link')
# for i in lst:
#     print(i.text)


# 先获取一个元素对象, 再查找该对象的下级
all_titles = chrome.find_element(By.ID, 'menu')
titles = all_titles.find_elements(By.TAG_NAME, 'li')
# print(titles)
for title in titles:
    print(title.text)